package com.da.javatest.demo.basic;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author chenlida
 * @date 2018/11/2 11:11
 * @Description:
 */
public class MatchesDemo {
    public static void main(String[] args) {
        String test = "www.alibaba.com";
        Pattern p = Pattern.compile("(alibaba)");
        Matcher matcher = p.matcher(test);
        System.out.println(matcher.find());
        System.out.println(matcher.group());
        Pattern p2 = Pattern.compile("(www)\\.(.*)\\.(.*)");
        Matcher matcher2 = p2.matcher(test);
        System.out.println(matcher2.find());
        System.out.println(matcher2.group(3));

    }
}
